package com.mine.crawler.util;

import java.net.MalformedURLException;
import java.net.URL;
import org.apache.log4j.Logger;


public class urlLink
{
	private String strUrl;
	private boolean visisted;
	private URL url;
	
	private static Logger log = Logger.getLogger(urlLink.class);
	
	public urlLink(String url_local)
	{
		strUrl = url_local;
		visisted = false;
		try
		{
			url = new URL(strUrl);
		}
		catch(MalformedURLException e)
		{
			log.error("ERROR - malformed URL "+ strUrl);
			e.printStackTrace();
		}
	}
	public String getStrUrl()
	{
		return strUrl;
	}
	public void setStrUrl(String strUrl)
	{
		this.strUrl = strUrl;
	}
	public boolean isVisisted()
	{
		return visisted;
	}
	public void setVisisted(boolean visisted)
	{
		this.visisted = visisted;
	}
	public URL getUrl()
	{
		return url;
	}
	public void setUrl(URL url)
	{
		this.url = url;
	}
	public int hashCode()
	{
		int val = 0;
		if(strUrl != null)
			val = strUrl.hashCode();
		return val;
	}
	public boolean equals(Object o)
	{
		String strVal = (String) o;
		if(strVal.hashCode() == this.hashCode())
			return true;
		else
			return false;
	}

}